package com.cldz.response.support;

import lombok.Data;

/**
 * @ Author     ：lixiao.
 * @ Date       ：Created in 15:29 2018/12/4
 * @ Description：
 * @ Modified By：
 */
@Data
public class ServerResponse<T> {

    private boolean result;

    private Integer totalCount;

    private T dataList;


    private String msg;

    public ServerResponse() {
    }

    public ServerResponse(boolean isSuccess){
        this.result = isSuccess;
    }

    public ServerResponse(boolean result,Integer number, T data){
        this.result = result;
        this.totalCount = number;
        this.dataList = data;
    }

    public static ServerResponse createResult(boolean result){
        return new ServerResponse(result);
    }

    public static <T> ServerResponse<T> createDataAndCount(Integer number, T data){
        return new ServerResponse<T>(Const.RESULT_SUCCESS,number,data);
    }
    public static <T> ServerResponse<T> createDataList(T data){
        return new ServerResponse<T>(Const.RESULT_SUCCESS,null,data);
    }



}
